import { defineStore } from "pinia";
import { CostConfig, CostCategory, CostInfo} from "@/interface/costCalculate";
export const CostCalculateStore = defineStore({
    id: "costCalculate",
    state: () => {
        return {
            costConfigs: [] as CostConfig[],
            currentCostCategory: CostCategory.Electricity, //当前计算的费用类型
            currentCostInfo: null as CostInfo|null //当前计算的费用
        };
    },
    actions: {
        clearCache() {
            
        }
    },
    getters: {},
    persist: {
        enabled: true, // true开启数据缓存
        strategies: [
            {
                storage: localStorage,
                paths: ["costConfigs", "currentCostCategory", "currentCostInfo"]
            }
        ]
    }
});
